xen/arm: Fix dom0 boot following c/s 580c45869
authorAndrew Cooper <andrew.cooper3@citrix.com>
Fri, 31 Aug 2018 18:01:25 +0000 (19:01 +0100)
committerJulien Grall <julien.grall@arm.com>
Mon, 3 Sep 2018 10:45:42 +0000 (11:45 +0100)
commit16bbf8e7b39b50457bb2f6547f166bd54d50e4cd
treeaf5f635735f83ac10de92661e0956ef8ed6ce575
parent342dcb6430d76ebd1ce229a02bad83f8881c9ac9
xen/arm: Fix dom0 boot following c/s 580c45869

c/s 580c45869 "Call arch_domain_create() as early as possible in
domain_create()" overlooked the fact that ARM uses is_hardware_domain() in at
least two places during arch_domain_create().

The bug manifests as:

  (XEN) Freed 292kB init memory.
  (XEN) traps.c:2017:d0v0 HSR=0x938c0007 pc=0xc0639d08 gva=0xe0800004 gpa=0x00000010481004

when dom0 tries to use the vuart.  Judging by other uses of
is_hardware_domain(), I expect the x86 PVH dom0 boot is similarly broken.

Reposition the code which sets up hardware_domain so that the
is_hardware_domain() predicate works correctly all the way through domain
creation.

While moving it, leave a related comment explaining the positioning of the
is_priv assignment, which in hindsight should have been part of c/s ef765ec98
when exactly the same problem was discovered for the is_control_domain()
predicate.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Julien Grall <julien.grall@arm.com>
Tested-by: Julien Grall <julien.grall@arm.com>
xen/common/domain.c